#include <stdio.h>

typedef int ( *increase_fn )( void* counter );
struct counter_i
{
    increase_fn increase;
};
struct normal_counter
{
    const struct counter_i* interface;
    int                     count;
};

int normal_counter_increase( struct normal_counter* self );

static const struct counter_i normal_counter_interface = {
    .increase = (increase_fn)normal_counter_increase,
};
void normal_counter_initialize( struct normal_counter* self )
{
    self->count = 0;
    self->interface = &normal_counter_interface;
}
int normal_counter_increase( struct normal_counter* self )
{
    return self->count++;
}
struct skip_counter
{
    const struct counter_i* interface;
    int                     count;
};
int skip_counter_increase( struct skip_counter* self );

static const struct counter_i skip_counter_interface = {
    .increase = (increase_fn)skip_counter_increase,
};
void skip_counter_initialize( struct skip_counter* self )
{
    self->count = 0;
    self->interface = &skip_counter_interface;
}
int skip_counter_increase( struct skip_counter* self )
{
    int r;
    r = self->count;
    self->count += 2;
    return r;
};
void app( struct counter_i** c, const char* prefix )
{
    int i, r;
    for ( i = 0; i < 2; i++ )
    {
        r = ( *c )->increase( c );
    }
    printf( "%s is now %d\n", prefix, r );
};
int main( int argc, const char** argv )
{
    struct normal_counter counter0;
    struct normal_counter counter1;
    struct skip_counter   counter2;
    normal_counter_initialize( &counter0 );
    normal_counter_initialize( &counter1 );
    skip_counter_initialize( &counter2 );
    app( (struct counter_i**)&counter0, "0" );
    app( (struct counter_i**)&counter1, "1" );
    app( (struct counter_i**)&counter2, "2" );
    return 0;
};